package rmbfxmarket;

import java.util.ArrayList;
import repast.simphony.context.DefaultContext;
import repast.simphony.engine.environment.RunEnvironment;
import repast.simphony.parameter.Parameters;
import repast.simphony.space.grid.Grid;
import repast.simphony.space.grid.GridBuilderParameters;
import repast.simphony.space.grid.RandomGridAdder;
import repast.simphony.space.grid.StrictBorders;
import repast.simphony.context.space.grid.GridFactoryFinder;

@SuppressWarnings("unchecked")

public class RMBFXMarketMakerContext extends DefaultContext{

	private int numberOfMarketMaker;
	private int agentID=0;
	ArrayList priceToBKM=new ArrayList();
	
	public RMBFXMarketMakerContext ( ){
		super("MaketMaker ", "MM"); 
		Parameters p = RunEnvironment.getInstance().getParameters();
	   // numberOfMarketMaker=(Integer) p.getValue("numberOfMarketMaker");

	     int gridWidth = (Integer)p.getValue("gridWidthOfMM");
	     int gridHeight = (Integer)p.getValue("gridHeightOfMM");
	
	     Grid grid = GridFactoryFinder.createGridFactory(null).createGrid("Grid", this,
			new GridBuilderParameters(new StrictBorders(),
					new RandomGridAdder(), true, gridWidth, gridHeight));
	     
	     for (int j=0; j<gridHeight; j++){
				for (int i=0; i<gridWidth; i++){
				RMBFXMarketMakerAgent agent=new RMBFXMarketMakerAgent(); 
				agent.setID(agentID);
				this.add(agent);
				grid.moveTo(agent, i, j);
				agentID++;
			   } 
         }
     }

	public int getNumberOfMarketMaker() {
		return numberOfMarketMaker;
	}

	public void setNumberOfMarketMaker(int numberOfMarketMaker) {
		this.numberOfMarketMaker = numberOfMarketMaker;
	}

	public int getAgentID() {
		return agentID;
	}

	public void setAgentID(int agentID) {
		this.agentID = agentID;
	}
	
}